#pragma once
#include "MURMUR2.h"

#define STRINGTOKEN_MURMURHASH_SEED 0x31415926

#pragma pack(push, 8)
class CUtlStringToken {
public:
    uint32_t mHashCode = 0U;
    const char* mDebugName = nullptr;

    explicit CUtlStringToken(const char* szKeyName)
    {
        mHashCode = MURMUR2::Hash(szKeyName, STRINGTOKEN_MURMURHASH_SEED);
        mDebugName = szKeyName;
    }

    constexpr CUtlStringToken(const uint32_t uHashCode, const char* szKeyName) :
        mHashCode(uHashCode), mDebugName(szKeyName) {
    }

    inline bool operator==(const CUtlStringToken& other) const
    {
        return (other.mHashCode == mHashCode);
    }

    inline bool operator!=(const CUtlStringToken& other) const
    {
        return (other.mHashCode != mHashCode);
    }

    inline bool operator<(const CUtlStringToken& other) const
    {
        return (mHashCode < other.mHashCode);
    }
};
#pragma pack(pop)

inline CUtlStringToken MakeStringToken(const char* szKeyName)
{
    return { MURMUR2::HashConst(szKeyName, STRINGTOKEN_MURMURHASH_SEED), szKeyName };
}